Caching is a common technique used in applications running on application servers to gain performance and scale while reducing cost of ownership. Caching is well suited for the typical transactional web-based applications because of their high read to write ratios. For example, in an on-line trading application, much more time is spent watching (reading) the prices of stock versus buying or selling stock (writing). When caching is productively employed within an eBusiness application, traffic to costly backend servers, such as database servers or legacy code running on mainframes, may be reduced. Thus, less capacity of such backend servers may be required which may lower the total cost of owning the system.
High volume web applications typically use large clusters of application servers to scale to the response time demands of customers. Caching in large clustered environments can present challenges in keeping cached data consistent. One common method employed by application servers is illustrated in FIG. 1. As seen in FIG. 1, the application servers 10 have corresponding caches 12. Message oriented middleware (MOM) 14 is utilized to replicate cached data and/or data invalidation notification between application server instances 10 in the cluster of application servers. Thus, data from the database 16 may be replicated in the caches 12 of the application servers 10. This replication may be controlled by the MOM 14 utilizing a message network.
Data replication in the caches 12 may be cost effective if the cost to replicate the data, which is usually measured in latency, is known to be more efficient than to recreate the data from the data source of origin. For example, if it takes 250 ms to completely replicate an object containing a companies net worth and it takes 2500 ms to calculate the companies net worth by interacting with backend data management systems, is may be preferable to replicate the net worth object rather than recalculate it. However, during peak times, when application servers are very busy, the busy CPUs and congested network may lead to delays which might cause the total replication of the net worth object to exceed 2500 ms. Typically, however, the decision of whether to replicate (cache) the net worth object or to recalculate it is a static decision and does not depend on a particular situation for replication. Thus, typically, the net worth object would be cached or recalculated independent of the particular timings for replication and/or recalculation.
Another variation of cache distribution is illustrated in FIG. 2. FIG. 2 illustrates off-loading of cache memory data to a disk cache. Thus, as seen in FIG. 2, the caches 12 of the application servers 10 may write cache data to a file system 20 to offload the data to a disk cache. Off-loading cache data to disk may be an effective way of ensuring that the memory-based cache does not exhaust memory. Disk offload can also be used to distribute cache data between the servers 10 in the cluster of application servers if the disk file is stored on a networked file system. As with replication described above, typically, the decision of whether to offload cache data to disk is a static decision and does not depend on a particular situation for data offload.